package ThreadAPI;

import java.lang.management.ThreadInfo;

public class JoinCase {
    //不加插入线程的话main线程永远是执行在最前面的
    //加入join插入线程后,main线程执行在后面了
    public static void main(String[] args) {
        Thread t=new Thread(()->{
            for (int i = 0; i < 100; i++) {
                String name=Thread.currentThread().getName();
                System.out.println(name+":@"+i);
            }
        },"土豆");
        t.start();
        try {
            t.join();//将t线程插入到main线程前
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        for (int i = 0; i < 10; i++) {
            System.out.println("min线程:"+i);
        }
    }
}
